package com.gs.SynAntiWandering.dialog;


import android.content.Context;

import com.gs.SynAntiWandering.R;

public class LoadingDialogUtils {
    private static volatile LoadingDialogUtils instance;

    private LoadingDialogUtils() {
    }

    public static LoadingDialogUtils getInstance() {
        if (instance == null) {
            synchronized (LoadingDialogUtils.class) {
                if (instance == null) {
                    instance = new LoadingDialogUtils();
                }
            }
        }
        return instance;
    }

    private static ToastDialog dialog;

    public void showLoading(Context mContext, String msg) {
        dialog = new ToastDialog(mContext).setMessage(msg);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(true);
        dialog.show();
    }

    public void showLoading(Context mContext) {
        dialog = new ToastDialog(mContext).setMessage(mContext.getString(R.string.loading));
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(true);
        dialog.show();
    }

    public void dismiss() {
        dialog.dismiss();
    }
}
